<%@ page import="java.time.Clock" %>
<%@ page import="java.time.ZoneId" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: think
  Date: 2020/7/10
  Time: 12:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body style="width:100%;height: 100%;background-color: #8c939d">
<%--<table border="1px" style="margin-top: 20%;margin-left: 0px;background-color: blue">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>地址</th>
    </tr>
    <tr>
        <td>1</td>
        <td>王力宏</td>
        <td>18</td>
        <td>中国</td>
    </tr>
    <tr>
        <td>1</td>
        <td>王力宏</td>
        <td>18</td>
        <td>中国</td>
    </tr>
    <tr>
        <td>1</td>
        <td>王力宏</td>
        <td>18</td>
        <td>中国</td>
    </tr>
</table>--%>



<table border="1px" style="margin-top:10%; margin-left: 40%">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>地址</th>
    </tr>

<%--<%
    int a=1;
    //Clock.tickSeconds(ZoneId.of("8"));
    Clock clock = Clock.tickSeconds(ZoneId.systemDefault());
    System.out.println(clock);
%>--%>

     <c:forEach begin="1" end="10" var="i" step="1">
<script>
    var num=1;
    setInterval(function () {
     var w = document.getElementsByClassName("wlh");
     var l = document.getElementsByClassName("lyf");
     if(num%2==1){
         w.style.backgroundColor="gold";
     }else {
         w.style.backgroundColor="green";
     }
        if(num%2==0){
            l.style.backgroundColor="gold";
        }else {
            l.style.backgroundColor="green";
        }
       num++;},1000)

</script>


         <c:if test="${i%2==1}">
             <tr style="background-color: gold" class="wlh">
         <td>i</td>
         <td>王力宏</td>
         <td>18</td>
         <td>中国</td>
             </tr>
         </c:if>
         <c:if test="${i%2==0}">
             <tr style="background-color:green" class="lyf">
                 <td>i</td>
                 <td>刘亦菲</td>
                 <td>18</td>
                 <td>中国</td>
             </tr>
         </c:if>
     </c:forEach>

</table>

</body>
</html>
